<!doctype html>
<html>
    <head>
        <meta name="renderer" content="webkit" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta charset="utf-8">
        <title>{$siteTitle}</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
        <link rel="shortcut icon" href="common/statics/images/favicon.ico" />
        <link rel="stylesheet" href="common/statics/css/bootstrap.min.css" />
        <link rel="stylesheet" href="common/statics/css/bootstrap-theme.min.css" />
        <link rel="stylesheet" href="common/statics/css/todc-bootstrap.min.css" />
        <link rel="stylesheet" href="common/statics/css/font-awesome.min.css" />
        <link rel="stylesheet" href="common/statics/css/vendor.css">
        <link rel="stylesheet" href="common/statics/css/app/main.css">
        <link rel="stylesheet" href="common/statics/css/angular-motion.css">
        <link rel="stylesheet" href="common/vendor/angularModules/gridster/angular-gridster.min.css">
        <link rel="stylesheet" href="{:U('FrontendRuntime/index?action=getCss')}" />
        <base href="{$APP_PATH}" />
    </head>
    <body ng-controller="MainCtl" ng-keydown="doMainKeyDown($event)">
        <header class="topest clearfix">
            <div class="pull-left topbar-brand">
                <a href="javascript:void(0);" ng-click="sidebarToggleExpand()" class="toggle_left_sidebar pull-left">
                    <i class="fa" ng-class="{'fa-angle-double-left':sidebar_expand,'fa-angle-double-right':!sidebar_expand}"></i>
                </a>
                <a ng-click="$root.goPage('/')" class="logo pull-left"></a>
            </div>
            <div class="navbar-nav" ng-controller="TopBarCtl">
                <ul id="nav-list" class="clearfix">
                    <li ng-repeat="nav in navs" ng-class="{'active': nav.id==active_nav}">
                        <a href="javascript:void(0);" 
                        title="{{'lang.navs.'+nav.label|lang}}" 
                        ng-click="toggleLeftMenu(nav.childs, nav.id)"
                        bs-tooltip="'{{'lang.navs.'+nav.label|lang}}'" data-trigger="hover" data-placement="bottom">
                            <i class="fa fa-{{nav.icon}}"></i>
                        </a>
                    </li>
                </ul>
            </div>
            <div class="pull-right topbar-right">
                {:tag("nav_bar_dropdown_html")}
                <a ng-click="$root.goPage('systemPreference')" id="topest_setting_btn">
                    <i class="fa fa-cog"></i>
                </a>
                <a ng-click="$root.goPage('department/Logout')">
                    <i class="fa fa-power-off"></i>
                </a>
            </div>
        </header>
        <div class="progress loadingStateBar" id="loadingStateBar">
            <div class="progress-bar progress-bar-info" id="loadingStateBarProgress"></div>
        </div>
        <section class="main-container">
            <aside ng-class="{'nexpand':!sidebar_expand}">
                <div class="nav-search input-group" ng-controller="multiSearchCtl">
                    <input type="text"
                       id="multiSearchInput"
                       placeholder="Search ..."
                       class="nav-search-input"
                       autocomplete="off"
                       ng-model="keyword"
                       ng-model-options="{debounce:300}"
                       ng-keydown="doSearchKeydown($event)"
                       ng-blur="doSearchBlur($event)"
                       ng-focus="doSearchFocus($event)" />
                   <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
                <div class="sidebar-user clearfix">
                    <a ng-click="$root.goPage('/my/preference')" class="sidebar-user-photo pull-left">
                        <img class="img-circle" ng-src="./uploads/Avatars/avatar.php?email={{userInfo.email}}&s=40" width="40" />
                    </a>
                    <div class="sidebar-user-action">
                        <a ng-click="$root.goPage('HOME/list/clearCache')" title="{{'lang.navs.clear_cache'|lang}}">
                            <i class="fa fa-refresh"></i>
                        </a>
                        <a href="javascript:void(0);" ng-click="$root.goPage('/')">
                            <i class="fa fa-home"></i>
                        </a>
                        <a ng-click="$root.goPage('my/preference')"><i class="fa fa-cog"></i></a>
                    </div>
                </div>
                <ul class="sidebar-nav">
                    <li ng-repeat="ln in left_navs" ng-class="{'active': sidebar_active_nav==ln.id}">
                        <a href="javascript:void(0);" 
                        ng-click="toggle_sidebar_active_nav(ln.id, ln.url);"
                        title="{{ln.label}}" 
                        id="{{ln.id}}"
                        class="nav-a" 
                        onclick="$(this).next('.has_child').toggleClass('hide')" 
                        bs-tooltip="'{{ln.label}}'" data-trigger="hover" data-placement="right">
                            <i class="fa fa-{{ln.icon|default:'circle-o'}}"></i>
                            <span ng-bind="ln.label"></span>
                            <i class="pull-right fa fa-angle-down" ng-show="ln.childs"></i>
                        </a>
                        <ul class="submenu" ng-class="{'has_child': ln.childs, 'hide': !sidebar_active_nav||sidebar_active_nav!=ln.id, 'visible': sidebar_active_nav && sidebar_active_nav==ln.id}">
                            <li ng-repeat="nct in ln.childs" ng-class="{'active': sidebar_active_nav==nct.id}">
                                <a href="javascript:void(0);" ng-click="toggle_sidebar_active_nav(nct.id, nct.url);" 
                                class="nav-a" 
                                bs-tooltip="'{{nct.label}}'" data-trigger="hover" data-placement="right">
                                    <i class="fa fa-angle-double-right"></i>
                                    <span>{{nct.label}}</span>
                                </a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </aside>
            <article class="main-content-container" ng-class="{'when_sidebar_nexpand':!sidebar_expand}">
                <div class="main-content-heading">
                    <h1>
                        <span ng-bind="currentPage.lang.app"></span>
                        <small ng-bind="currentPage.lang.module" ng-show="currentPage.lang.module"></small>
                    </h1>
                    <div class="main-content-heading-tools">
                        <a href="javascript:void(0);" 
                          class="wiki" 
                          ng-show="$root.currentPage.app" 
                          ng-click="goToWiki($root.currentPage.app)"                  
                          title="{{currentPage.lang.app}} - {{'lang.actions.view_manunal'|lang}}" 
                          target="_blank">
                            <i class="fa fa-question-circle"></i>
                        </a>
                        <a href="http://project.ng-erp.com/projects/ones/boards" title="{{'lang.actions.get_support'|lang}}" class="support" target="_blank">
                            <i class="fa fa-support"></i>
                        </a>
                        <a href="javascript:void(0);" 
                        title="{{'lang.actions.online_chat'|lang}}" 
                        class="chat" 
                        onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 && window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open('https://chat.ng-erp.com', 'mibew', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=450,resizable=0');this.newWindow.focus();this.newWindow.opener=window;return false;">
                            <i class="fa fa-comments"></i>
                        </a>
                    </div>
                </div>
                <div id="alerts-container"></div>
    
                <div class="page-content">
                    <div class="row">
                        <div class="col-xs-12 am-fade-and-scale" ng-view></div>
                    </div>
                    <hr class="hr-10 hr-double" />
                    <div class="row footer-copy">
                        <p class="text-center">
                            &copy; 2014 Present by <a href="http://www.ng-erp.com" target="_blank">ONES Team</a>
                            v{:DBC('system.version')}
                        </p>
                    </div>
                    <!--//demo-->
                </div><!-- /.page-content -->
            </article>
        </section>
        <div class="bottomAlertContainer" id="bottomAlertContainer"></div>
    
        <ul class="dropdown-menu contextMenuDropdown ng-hide"
            role="menu"
            ng-show="contextMenu.items.length>0"
            id="contextMenuDropdown"
            style="left:{{contextMenu.left||-9999}}px;top:{{contextMenu.top||-9999}}px;">
            <li ng-repeat="act in contextMenu.items track by $index" class="ui-menu-item" role="presentation">
                <a tabindex="-1"
                   class="ui-corner-all"
                   ng-click="act.action(null,contextMenu.selectedItems,contextMenu.currentItem);hideContextMenu();">
                    <i class="fa fa-{{act.icon}}"></i>
                    <span ng-bind="act.label"></span>
                   </a>
            </li>
        </ul>
        <script type="text/javascript">
            var ones = {
                BaseConf: {
                    LoadedApps: {$loadedAppsStr},
                    DEBUG: {$isDebug}
                },
                basePath: '{$APP_PATH}',
                userInfo: {$userInfo},
                asyncScript: [],
            };
            <if condition="DBC('site.html5.mode')">
                ones.useHTML5 = {:DBC('site.html5.mode')};
            </if>
        </script>
        <foreach name="javascripts" item="js">
            <script src="{$js}"></script>
        </foreach>
        
        <script type="text/javascript">
            /**
             * i18n
             * */
             jQuery(function(){
                 /**
                  * 加载语言包
                  * */
                 ones.i18n = ones.caches.getItem("ones.i18n");
                 if((!ones.i18n || isEmptyObject(ones.i18n)) && !ones.installing) {
                     jQuery.get(ones.BaseConf.BSU+"FrontendRuntime/index/action/getI18n/lang/zh-cn").success(function(data) {
                         ones.caches.setItem("ones.i18n", data, 1);
                         ones.i18n = ones.caches.getItem("ones.i18n");
                         if(!ones.i18n) {
                             throw("can't load i18n package.");
                         }
        
                         angular.element(document).ready(function() {
                             angular.bootstrap(document, ['ones']);
                         });
                     });
                 } else {
                     angular.element(document).ready(function() {
                         angular.bootstrap(document, ['ones']);
                         $('[data-toggle="tooltip"]').tooltip();
                     });
                 }
             });
        </script>
    </body>
</html>